package com.higgins.server;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.higgins.client.dataModel.CoveringLetterDTO;
import com.higgins.client.dataModel.LawFirmDTO;
import com.higgins.client.dataModel.StrategyDTO;

@Entity
@Table(name = "lawFirms")
public class LawFirm {
    private Long id;
    private String name;
    private String address;
    @Column(name="sectorId")
    private Long sectorId;
    @Column(name="lawFirmTypeId")
    private Long lawFirmTypeId;
    private Double turnover;
    private Integer noSolicitors;
    private Integer noOffices;

    public LawFirm() {
        // This is used by JPA 
    }

    @Id
    @GeneratedValue(generator = "increment")
    @GenericGenerator(name = "increment", strategy = "increment")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getAddress()	{
    	return address;
    }
    public void setAddress(String address)	{
    	this.address = address;
    }
    public Long getSectorId()   {
        return sectorId;
    }
    public void setSectorId(Long sectorId)  {
        this.sectorId = sectorId;
    }
    public Long getLawFirmTypeId()  {
        return lawFirmTypeId;
    }
    public void setLawFirmTypeId(Long lawFirmTypeId)    {
        this.lawFirmTypeId = lawFirmTypeId;
    }

    public void setTurnover(Double turnover)    {
        this.turnover = turnover;
    }
    public Double getTurnover() {
        return turnover;
    }
    public void setNoSolicitors(Integer noSolicitors)   {
        this.noSolicitors = noSolicitors;
    }
    public Integer getNoSolicitors()    {
        return noSolicitors;
    }
    public void setNoOffices(Integer noOffices) {
        this.noOffices = noOffices;
    }
    public Integer getNoOffices()   {
        return noOffices;
    }

    public LawFirmDTO toDTO()	{
    	LawFirmDTO dto = new LawFirmDTO();
    	dto.setId(id);
    	dto.setName(name);
    	dto.setAddress(address);
    	dto.setSectorId(sectorId);
    	dto.setLawFirmTypeId(lawFirmTypeId);
    	dto.setTurnover(turnover);
    	dto.setNoSolicitors(noSolicitors);
    	dto.setNoOffices(noOffices);
    	return dto;
    }
    public void update(LawFirmDTO dto)	{
    	this.name = dto.getName();
    	this.address = dto.getAddress();
    	this.sectorId = dto.getSectorId();
    	this.lawFirmTypeId = dto.getLawFirmTypeId();
    	this.turnover = dto.getTurnover();
    	this.noSolicitors = dto.getNoSolicitors();
    	this.noOffices = dto.getNoOffices();
    }
}